﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc;
using System;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Authentication;
using System.Security.Claims;
using System.Diagnostics;
using SqlSugar;

namespace Nasty.Core.Attributes
{
    /// <summary>
    /// Nasty扩展标签
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, Inherited = true)]
    public class NastyColumnAttribute : SugarColumn
    {
        private bool _Required;
        private bool _IsRepeat;
        private string _RepeatLink;
        private string _OnChange;
        private bool _IsSecurity;

        /// <summary>
        /// 监听属性变更时触发的方法名 目前只支持Save/Add/Update方法
        /// </summary>
        public string OnChange
        {
            get
            {
                return _OnChange;
            }
            set
            {
                _OnChange = value;
            }
        }

        /// <summary>
        /// 是否必填
        /// </summary>
        public bool Required
        {
            get
            {
                return _Required;
            }
            set
            {
                _Required = value;
            }
        }

        /// <summary>
        /// 是否校验重复,启用时，Required也会默认启用校验，只支持string,int 简单类型校验，填写RepeatLink可以进行联动校验
        /// </summary>
        public bool IsRepeat
        {
            get
            {
                return _IsRepeat;
            }
            set
            {
                _IsRepeat = value;
            }
        }

        /// <summary>
        /// 启用IsRepeat时生效，联动其他字段进行查询，联动字段只支持string,int简单类型
        /// 单个联动：Name
        /// 多个联动：Id,Name  英文逗号隔开
        /// </summary>
        public string RepeatLink
        {
            get
            {
                return _RepeatLink;
            }
            set
            {
                _RepeatLink = value;
            }
        }
 
        /// <summary>
        /// 是否加密处理,只支持string类型
        /// </summary>
        public bool IsSecurity
        {
            get
            {
                return _IsSecurity;
            }
            set
            {
                _IsSecurity = value;
            }
        }

    }



  
}

